package com.pactera.asmp.server.entity;

import java.time.LocalDateTime;
import java.util.List;

import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import javax.validation.constraints.Size;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.pactera.asmp.server.pojo.DeviceInfo;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
public class  TaskDTO {
    private  Integer id;
    private  Integer projectId;
    @NotEmpty(message = "任务名称不允许为空")
    @Size(max = 200,message = "任务名称长度不能超过200")
    @Pattern(regexp = "^[^\\s]+(\\s+[^\\s]+)*$", message = "任务名称格式不正确")
//    @Pattern(regexp = "^[^￥#%…&*@\\s]*$", message = "任务名称格式不正确")
    private String name;
    @NotNull(message = "任务类型不允许为空")
    private Integer type;  //0 ASMP Email Report Task， 1 Auto Test Task
    @NotNull(message = "执行方式不允许为空")
    private Integer cycleType; //0 定期执行， 1，延时执行， 2， 立刻执行
//    @NotNull(message = "计划时间不允许为空")
    @Size(max = 100,message = "计划时间长度0-100")
    private String cron;
    @NotEmpty(message = "脚本不允许为空")
    @Size(min = 1,max = 200,message = "脚本长度1-200")
    private String scriptIds;
    private String packages;
    @NotNull(message = "设备ID不允许为空")
    @Size(min = 1,max = 36,message = "设备ID长度1-36")
    private String duid;
    @NotNull(message = "执行次数不允许为空")
    private Integer exeNumber;
    private Integer monkeyExeNumber;
    private Integer successNumber;
    private Integer failNumber;
    @Size(max = 500,message = "失败描述长度0-500")
    private String failReason;
    private Integer status;   // 0 等待执行，1 正在执行， 2 执行失败， 3.执行成功  4. 任务取消 5. 设备被占用，执行失败
    private Integer execType; // 0 创建任务  1 计划执行  2 重试执行    3 从创建任务修改为计划执行状态 （重新测试操作）
    private Integer parentId;
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime execTime;
    private Integer userId;
    private Integer startJob;  // 0 未启动过       1 已启动过
    private Integer completedJob;  // 0 未完成JOB   1 已完成JOB

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime createTime;

    private String userName;

    private Integer exeProcessTimes;  // 已经执行的次数
    private String projectName;

    private Integer exePlanTimes;   // 任务创建时计划需要执行的次数

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime exeStartTime;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime exeEndTime;

    private String execTimeFormat;

    private Integer isDeleted;

    private String actExecTime;

    private List<DeviceInfo> deviceInfos;

    List<TaskDTO> subTaskDTOs;

    private Integer qrtzExeTimes;   // 定时任务执行次数

    private String errorVideoType;

    // 流水线历史id
    private Integer productionLineHistoryId;

    // 流水线历史信息
    private ProductionLineHistory productionLineHistory;

    // 1 simulater 2上位机
    private Integer coldHotStartType;
    private String coldHotStartActivity;
    //1（cold）：冷启动，2（warm）：热启动
    private Integer coldHotStartMode;

    private Integer intervalTime;

    private String logType;

    private Integer enableJira;

    private String canReviewLogFileId;
}
